package strategy.spring;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;
import java.util.Optional;

@Service
public class StrategyContext {
    @Resource(name = "strategyContextMap")
    Map<String, Strategy> map;

    public Object selectAddressVo(String state, String userId) {
        Strategy strategy = map.get(state);
        if(strategy == null){
            throw new RuntimeException("错误的状态");
        }
        return strategy.selectAddressVo(userId);
    }

}
